import java.util.*;


public class Solution1 {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 旋转字符串
     * @param A string字符串 
     * @param B string字符串 
     * @return bool布尔型
     */
    public boolean solve (String A, String B) {
        // write code here
        if(A.length() != B.length()) {
            return false;
        }

        for(int i = 0; i <= A.length(); i++) {
            String A1 = A.substring(0, i);
            String A2 = A.substring(i, A.length());
            String B1 = B.substring(0, B.length() - i);
            String B2 = B.substring(B.length() - i, B.length());
            if(A1.equals(B1) && A2.equals(B2) || A1.equals(B2) && A2.equals(B1)) {
                return true;
            }
        }
        return false;
    }
}